<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script type="text/javascript" src="//statres.quickapp.cn/quickapp/js/routerinline.min.js"></script>
  <title>Document</title>
</head>

<body>
  <button onclick="aa()">点击跳转</button>
  <script type="text/javascript">
    function aa() {
      appRouter(
        'com.application.quickapp_ysy',
        '/bookContent',
        { bid: 7, chapterid: 2169 },
      )
    }
    function c() {
      var ua = window.navigator.userAgent.toLocaleLowerCase();
      var isfcous = document.hasFocus ? document.hasFocus() : false;
      var oParameter = {};
      var timer = null;
      var fnpageblur = true;
      var stoptime = 0;
      var oblacklist = false;
      var obAvailable = false;
      var ishuawei = /huawei|honor/.test(window.navigator.userAgent.toLowerCase());
      var isOpenApp = false;

      // var ishidden = false;
      if (ishuawei) {
        obAvailable = true;
      } else {
        try {
          channelReady(function (bAvailable) {
            obAvailable = bAvailable;
          });
        } catch (e) {
          obAvailable = false;
        }
      }

      var QYY = {
        iswx: /micromessenger/.test(ua), //是否是微信
        isios: /iphone|ipod|ipad/.test(ua), //是否是ios
        relay: 'https://apps.apple.com/cn/app/id1450779570', //跳转链接地址
        apkUrl: '', //下载apk包
        entry: '', //拉起快应用入口页面
        channelCode: 'KWY1000021',
        jumpPage: 'Index', //跳转至快应用内页面
        bookId: '', //
        chapterId: '',
        uuid: '', //
        pname: 'com.dianzhong.mfxsdq01',
        ntimeout: 3000,
        getmyid: '',
        starttime: new Date,
        endtime: ''

      };


      var shost = window.location.host;
      var spathname = window.location.pathname;
      spathname = spathname.split('/');
      QYY.getmyid = spathname[spathname.length - 1];

      var sdomain = window.location.protocol + '//xsmfcps.hzage.cn';
      var sipurl = window.location.protocol + '//xsmfdq.kkyd.cn';
      if (/m\.nimei\.com|192\.168\.100/.test(shost)) {
        QYY.getmyid = '54_KTT2000038';
        sdomain = '//jk.kuaikandushu.cn';
      }


      //5秒后显示刷新按钮
      function loadingshow() {

        setTimeout(function () {
          if (!QYY.isios && /\.apk$/.test(QYY.apkUrl)) {
            $('.loading_span').html('打开失败<br/>即将下载APP，安装后继续阅读');
            $('.loading_reload').show();
          } else {
            $('.loading_span').html('启动失败，请点击“重新加载”');
            $('.loading_reload').show();
          }
        }, 5000)

      }

      function directjumpapk() {
        clearTimeout(timer);

        quickappLog([803, {
          qmap: qlmap({
            siet: 911,
            ua: ua
          })
        }, 'land_copy']);

        if (QYY.isios && (/\.apk$/.test(QYY.apkUrl) || !QYY.apkUrl)) {
          //ios 跳转访问链接
          $('.loading_span').html('正在跳转App Store');
          apkclick(QYY.relay);
        } else if (/\.apk$/.test(QYY.apkUrl)) {
          $('.loading_span').html('打开失败<br/>即将下载APP，安装后继续阅读');
          $('.loading_reload').show();
          apkclick(QYY.apkUrl);
        } else {
          $('.loading_span').html('即将跳转公众号继续阅读');
          $('.loading_reload').show();
          apkclick(QYY.apkUrl);
        }
      }

      function fnStart() {
        if (oblacklist) {
          directjumpapk();
          return false;
        }


        if (QYY.iswx) {
          //微信环境
          if (QYY.isios) {

            quickappLog([803, {
              qmap: qlmap({
                siet: 4
              })
            }, 'land_copy']);

            if (/\.apk$/.test(QYY.apkUrl) || !QYY.apkUrl) {
              $('.loading_span').html('正在跳转App Store');
              //ios 跳转访问链接
              apkclick(QYY.relay);
            } else {
              $('.loading_span').html('即将跳转公众号继续阅读');
              apkclick(QYY.apkUrl);
            }
          } else {
            //andr
            goqyy();
            console.log('goqyywx');
          }

        } else {
          //非微信环境
          if (QYY.isios) {

            quickappLog([803, {
              qmap: qlmap({
                siet: 4
              })
            }, 'land_copy']);
            //ios 跳转访问链接
            if (/\.apk$/.test(QYY.apkUrl) || !QYY.apkUrl) {
              //ios 跳转访问链接
              $('.loading_span').html('正在跳转App Store');
              apkclick(QYY.relay);
            } else {
              $('.loading_span').html('即将跳转公众号继续阅读');
              apkclick(QYY.apkUrl);
            }
          } else {
            //andr
            goqyy();

          }

        }

      }

      //微信外拉起快应用
      function goqyy() {
        setTimeout(qyyAppRouter(), 0);
        // qyyAppRouter();

        //超时跳链接
        stoptime = Date.parse(new Date()) / 1e3;
        timer = setTimeout(function () {
          if (QYY.apkUrl) {
            //ios 跳转访问链接
            if (/\.apk$/.test(QYY.apkUrl)) {
              //ios 跳转访问链接
              $('.loading_span').html('打开失败<br/>即将下载APP，安装后继续阅读');
            } else {
              $('.loading_span').html('即将跳转公众号继续阅读');
            }

            quickappLog([803, {
              qmap: qlmap({
                siet: 3
              })
            }, 'land_copy']);
            stoptime = Date.parse(new Date()) / 1e3;
            timer = setTimeout(function () {

              if (Date.parse(new Date()) / 1e3 - stoptime > 3) {

                quickappLog([803, {
                  qmap: qlmap({
                    siet: 364
                  })
                }, 'land_copy']);
                return false;
              }
              //https://xsmfdq.kkyd.cn
              myjsonp({
                url: sipurl + '/glory/share/getPullStatus',
                data: {},
                success: function (ret) {
                  if (ret.status == 1) {
                    isOpenApp = true;
                  } else {
                    routerAApkUrl(398, QYY.apkUrl);
                  }
                }
              });

            }, 2000)
          }
        }, QYY.ntimeout);

      }


      function routerAApkUrl(ssiet, apkurl) {
        quickappLog([803, {
          qmap: qlmap({
            siet: ssiet
          })
        }, 'land_copy']);
        apkclick(apkurl);
      }

      //拉起快应用
      function qyyAppRouter() {
        stoptime = Date.parse(new Date()) / 1e3;

        try {
          appRouter(QYY.pname, "/" + QYY.entry, {
            channelCode: QYY.channelCode,
            jumpPage: QYY.jumpPage,
            bookId: QYY.bookId,
            chapterId: QYY.chapterId,
            uuid: QYY.uuid
          })

          $('.loading_span').html('正在打开快应用<br/>出现权限确认时请点击确认，以便继续阅读');

          quickappLog([803, {
            qmap: qlmap({
              siet: 1
            })
          }, 'land_copy']);

          setTimeout(function () {

            if (Date.parse(new Date()) / 1e3 - stoptime > 3) {

              quickappLog([803, {
                qmap: qlmap({
                  siet: 101
                })
              }, 'land_copy']);
              return false;
            }


            //https://xsmfdq.kkyd.cn
            myjsonp({
              url: sipurl + '/glory/share/getPullStatus',
              data: {},
              success: function (ret) {
                if (ret.status == 1) {
                  isOpenApp = true;
                } else {
                  try {

                    if (isdfocus) {
                      if (document.hasFocus()) {
                        routerAHap(102);
                      }
                    } else {
                      routerAHap(108);
                    }
                  } catch (e) {

                    routerAHap(103);

                  }
                }
              }
            });

          }, 2000)
        } catch (e) {
          //不支持直接拉起
          //拉起快应用deplink
          $('.loading_span').html('正在打开快应用<br/>出现权限确认时请点击确认，以便继续阅读');
          routerAHap(2);
        }
      }


      function routerAHap(ssiet) {
        var ohapa = document.createElement('a');
        ohapa.href = 'hap://app/' + QYY.pname + '/' + QYY.entry + '?channelCode=' + QYY.channelCode + '&jumpPage=' +
          QYY.jumpPage + '&bookId=' + QYY.bookId + '&chapterId=' + QYY.chapterId + '&uuid=' + QYY.uuid;
        ohapa.setAttribute('style', 'position: absolute;left: -1000rem;height: 1rem;width: 1rem;overflow: hidden');
        document.body.appendChild(ohapa);
        ohapa.click();

        quickappLog([803, {
          qmap: qlmap({
            siet: ssiet
          })
        }, 'land_copy']);
      }
    }


  </script>



</body>

</html>